<script setup>
import { articleGetArticleSortService } from '@/api/article'
import { ref } from 'vue'

defineProps({
  modelValue: {
    type: [Number, String]
  }
})

// 子传父
const emit = defineEmits(['update:modelValue'])
// 获取文章分类列表
const articleSortList = ref([])
const getArticleSortList = async () => {
  const res = await articleGetArticleSortService()
  articleSortList.value = res.data.data
}
getArticleSortList()
</script>

<template>
  <el-select
    :modelValue="modelValue"
    @update:modelValue="emit('update:modelValue', $event)"
  >
    <el-option
      v-for="item in articleSortList"
      :key="item.id"
      :label="item.articleSortTitle"
      :value="item.id"
    ></el-option>
  </el-select>
</template>
